<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:c="http://java.sun.com/jstl/core"
				xmlns:t="http://myfaces.apache.org/tomahawk"
				template="/pages/crud_template.xhtml"> 

	<ui:param name="crudBean" value="#{consultaConciliacaoSinteticoBean}" />
	
	<ui:define name="saveStateObjectsDefined">
		<t:saveState value="#{crudBean.listaLocaisPagamentos}" />
	</ui:define>
	
	<ui:define name="requiredFieldsMessage">
		<h:outputText value="#{bundle.peloMenosUmDosCamposObrigatorios}" rendered="#{crudBean.searching}"/>
	</ui:define>
	
	<ui:define name="buttonItens">
		<!-- Painel dos botoes de pesquisa -->
		<h:panelGroup rendered="#{crudBean.searching}">
			<a4j:commandButton value="Pesquisar" actionListener="#{crudBean.pesquisar}" reRender="tblData"/>
			<h:outputText value=" "/>
			<h:commandButton value="Exportar Planilha" action="#{crudBean.exportExcel}" reRender="tblData"/>
		</h:panelGroup>
	</ui:define>
	
	<ui:define name="content">
		<!-- Painel de Pesquisa - Inicio -->
		<h:panelGroup id="panelGroupDePesquisa" rendered="#{crudBean.searching}">
			<f:subview id="viewBusca">
				<table>
					<tr>
						<td class="tdCor" width="40%"><h:outputText value="Período da Baixa"/> *</td>
						<td class="tdBranco">
							<rich:calendar value="#{crudBean.searchObject.filtro.dataBaixaInicial}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
							<h:outputText value=" Até " />
							<rich:calendar value="#{crudBean.searchObject.filtro.dataBaixaFinal}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="25%"><h:outputText value="Locais de Pagamento"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.conciliacaoSinteticaPK.localPagamento}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.codigo}" itemLabel="#{o.descricao}" value="#{crudBean.listaLocaisPagamentos}" />
    						</h:selectOneMenu>
						</td>
					</tr>
					<tr>
						<td class="tdCor"><h:outputText value="Divergência"/></td>
						<td class="tdBranco">
							<table style="width: 200px;">
     		 					<tr>
     		 						<td>
										<h:selectOneRadio value="#{crudBean.searchObject.possuiDivergencia}">
										   <f:selectItem itemValue="T" itemLabel="Todos"/>   
										   <f:selectItem itemValue="S" itemLabel="Sim"/>   
										   <f:selectItem itemValue="N" itemLabel="Não"/>   
										</h:selectOneRadio>                                
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</f:subview>
		</h:panelGroup>
		<!-- Painel de Pesquisa - Fim -->
	</ui:define>
	
	<ui:define name="list">
		<h:panelGroup id="panelGroupDeListagem" rendered="#{crudBean.searching}">
			<f:subview id="viewListagem">
				<rich:dataTable id="tblData" value="#{crudBean.searchResult}" binding="#{crudBean.tblData}" var="rst" style="width: 100%;" rowClasses="par,impar">
               		
               		<rich:column style="text-align: left;" sortBy="#{rst.conciliacaoSinteticaPK.descricaoLocalPagamento}">
						<f:facet name="header">
							<h:outputText value="Local de Pagamento" />
						</f:facet>
						<h:outputText value="#{rst.conciliacaoSinteticaPK.descricaoLocalPagamento}"/>
					</rich:column>
               		<rich:column style="text-align: center;" sortBy="#{rst.conciliacaoSinteticaPK.dataBaixa}">
						<f:facet name="header">
							<h:outputText value="Data da Baixa" />
						</f:facet>
						<h:outputText value="#{rst.conciliacaoSinteticaPK.dataBaixa}"/>
					</rich:column>
               		<rich:column style="text-align: right;" sortBy="#{rst.valorFinanceiro}">
						<f:facet name="header">
							<h:outputText value="Valor Financeiro" />
						</f:facet>
						<h:outputText value="#{rst.valorFinanceiro}"/>
					</rich:column>
               		<rich:column style="text-align: right;" sortBy="#{rst.valorRazao}">
						<f:facet name="header">
							<h:outputText value="Valor Razão" />
						</f:facet>
						<h:outputText value="#{rst.valorRazao}"/>
					</rich:column>
               		<rich:column style="text-align: right;" sortBy="#{rst.diferencaValor}">
						<f:facet name="header">
							<h:outputText value="Diferença" />
						</f:facet>
						<h:outputText value="#{rst.diferencaValor}"/>
					</rich:column>
               		<rich:column style="text-align: center;" sortBy="#{rst.possuiDivergencia}">
						<f:facet name="header">
							<h:outputText value="Divergência" />
						</f:facet>
						<h:outputText value="#{rst.possuiDivergencia}"/>
					</rich:column>
					
					<f:facet name="footer">
						<rich:columnGroup rendered="#{crudBean.searching}">
	                      	<rich:column colspan="2" style="text-align: right;">
					     		<h:outputText value="Total" />
			 		    	</rich:column>
	                       	<rich:column style="text-align: right;">
	                           	<h:outputText value="#{crudBean.valorTotalFinanceiro}"/>
	                       	</rich:column>
	                       	<rich:column style="text-align: right;">
	                           	<h:outputText value="#{crudBean.valorTotalRazao}"/>
	                       	</rich:column>
	                       	<rich:column style="text-align: right;">
	                           	<h:outputText value="#{crudBean.valorTotalDiferenca}"/>
	                       	</rich:column>
	                       	<rich:column colspan="3" style="text-align: right;">
	                           	<h:outputText value=""/>
	                       	</rich:column>
                       	</rich:columnGroup>
                    </f:facet>
				</rich:dataTable>
			</f:subview>
		</h:panelGroup>
	</ui:define>
	
</ui:composition>